<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('applications', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('app_key', 16)
                ->unique();
            $table->string('app_secret', 32);
            $table->string('password', 16)
                ->comment('海报的解压密码')
                ->nullable();
            $table->unsignedBigInteger('admin_id')
                ->unique();
            $table->easyStatus();
            $table->unsignedBigInteger('domain_pool_id')
                ->index()
                ->nullable();
            $table->dateTime('expired_at')
                ->nullable()
                ->comment('过期时间');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('applications');
    }
};
